<div class="page">
	<div class="pageContent">
		<div class="panelBar">
			<ul class="toolBar">
				<li><a class="add" url="account/account_add.html"
					target="dialog" callback="navTab.reload()" rel="user_add" width="780"
					height="600" titleable="false"><span>添加</span> </a></li>
				<li><a class="delete" url="/account/{user_id}"
					area="tbody.list" callback="navTab.reload()" type="delete"
					target="navTabTodo" title="确定要删除选中的数据吗？" warn="请选择需要删除的数据项！"><span>删除</span>
				</a></li>
				<!-- 	
				<li class="line">line</li>
				<li><a class="icon" href="#"><span>导入EXCEL</span></a></li>
				 -->
			</ul>
		</div>

		<table class="list" width="98%" layoutH="54">
			<thead>
				<tr>
					<th width="25"><input type="checkbox" name="objectId"
						value="user_id" /></th>
					<th width="80">编号</th>
					<th width="100">账号</th>
					<th width="150">角色</th>
					<th>描述</th>
					<th align="right" width="50">操作</th>
				</tr>
			</thead>
			<tbody style="display: none;" class="templet">
				<tr user="${user_id}">
					<td><input type="checkbox" name="user_id" value="${user_id}"
						code="if(${user_id}==DWZ.user.userId) return 'disabled';" /></td>
					<td align="center">${num}</td>
					<td align="center" name="username">${username}</td>
					<td align="center" name="name">${name}</td>
					<td align="left" name="description" title="${description}">${description}</td>
					<td align="center"><a class="edit" href="javascript:void(0);" name="update"
						url="account/account_update.html?user_id=${user_id}&role_id=${role_id}"
						target="dialog" warn="非法参数（${user_id}）" callback="updateUserItem"><span>修改</span>
					</a></td>
				</tr>
			</tbody>
			<tbody class="list" action="/account">

			</tbody>
		</table>

		<div class="panelBar">
			<div class="pages"></div>
			<div class="pagination" totalCount="0" numPerPage="20"
				pageNumShown="10" currentPage="1"></div>
		</div>

	</div>
</div>
<script>
	function updateUserItem(item, dom) {
		var table = $(dom).parents("table.list");
		var user = $("tr[user=" + item.user_id + "]", table);
		user.find("td[name=username]").text(item.username);
		user.find("td[name=name]").text(item.role.name);
		user.find("td[name=password]").text(item.password);
		user.find("td[name=role_id]").text(item.role_id);
		user.find("td[name=description]").text(item.description);
		user.find("a[name=update]").attr("url","account/account_update.html?user_id="+item.user_id+"&role_id="+item.role_id);
		alertMsg.correct("更新成功");
	}
</script>
